<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="java.util.*,linuxbox.filelib.taglib.*,linuxbox.exception.*,linuxbox.filelib.logic.*,linuxbox.BoxStatic,linuxbox.admin.logic.*,linuxbox.admin.bean.*" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>
<%@ taglib uri="/linuxbox/FileLib.tld" prefix="filelib" %>

<jsp:include page="/en/jsp/header.jsp" flush="false"/>

<%
  FileLibHome home = FileLibHome.getInstance();
  FileLibEntry curEntry = (FileLibEntry) session.getAttribute("filelib.CURENTRY");
  if (curEntry == null)
  {
//servlet get the record for us
//  throw new Exception("Can't find the record!");
    curEntry = home.get(home.ROOT);
  }

  int curFolderID = curEntry.getID();

  String SORTBY = (String) session.getAttribute("filelib.SORTBY");
  if (SORTBY==null)
  {
    SORTBY = "name";
    session.setAttribute("filelib.SORTBY", SORTBY);
  }

  boolean sortAsc = true;
  String tmp = (String) session.getAttribute("filelib.ASC");
  if (tmp!=null && tmp.length() > 0)
    sortAsc = new Boolean(tmp).booleanValue();
  else
    session.setAttribute("filelib.ASC", "true");
  UserManager um = UserManager.getInstance();

  String folderContentAction = BoxStatic.servletDir+"FolderContentAction";

%>

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
	    &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
	    <b><%=boxName%> - File Library&nbsp;</b>
    </td>
    <td align=right>
      <a href="<%=BoxStatic.servletDir%>BoxFileLibSettingsAction?SubmitEdit=edit">
        Settings
      </a>
    </td>
  </tr>
</table>
<hr width=\"100%\" color=#E06000 align=left>


<STYLE>.table_hd {
	BORDER-RIGHT: #828282 1px solid; BORDER-TOP: #dcdcdc 1px solid; BORDER-LEFT: #eeeeee 1px solid; CURSOR: default; BORDER-BOTTOM: #828282 1px solid; BACKGROUND-COLOR: #cccccc
}
.tabtxt {
	COLOR: #000000
}
A:hover {
	COLOR: #000000; TEXT-DECORATION: underline
}
.tabtxtAdminselected {
	FONT-WEIGHT: 600; COLOR: #000000
}
A.tabtxt {
	FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Tahoma; TEXT-DECORATION: none
}
A.tabtxt:hover {
	FONT-SIZE: 12px; COLOR: #cc0000; FONT-FAMILY: Tahoma; TEXT-DECORATION: underline
}
A.tabtxtselected {
	COLOR: #000000; TEXT-DECORATION: none
}
A.tabtxtselected:hover {
	COLOR: #000000; TEXT-DECORATION: underline
}
TD {
	FONT-SIZE: 12px; FONT-FAMILY: Tahoma
}
DIV {
	FONT-SIZE: 12px; FONT-FAMILY: Tahoma
}
.tabAdminselected {
	BORDER-RIGHT: #075685 2px solid; BORDER-TOP: #075685 2px solid; FONT-WEIGHT: 600; BORDER-LEFT: #075685 2px solid; BORDER-BOTTOM: #eeeeee 2px solid; BACKGROUND-COLOR: #eeeeee
}
.tabselected {
	BORDER-RIGHT: #075685 2px solid; BORDER-TOP: #075685 2px solid; FONT-WEIGHT: 600; BORDER-LEFT: #075685 2px solid; BORDER-BOTTOM: #ffffff 2px solid; BACKGROUND-COLOR: #ffffff
}
.tab {
	BORDER-RIGHT: #075685 1px solid; BORDER-TOP: #075685 1px solid; BORDER-LEFT: #075685 1px solid; BORDER-BOTTOM: #075685 2px solid; BACKGROUND-COLOR: #90a8c8
}
.empty {
	BORDER-RIGHT: #075685 0px solid; BORDER-TOP: #075685 0px solid; BORDER-LEFT: #075685 0px solid; BORDER-BOTTOM: #075685 2px solid
}
.workarea {
	BORDER-RIGHT: #075685 2px solid; BORDER-TOP: #075685 0px solid; BORDER-LEFT: #075685 2px solid; BORDER-BOTTOM: #075685 2px solid; BACKGROUND-COLOR: #ffffff
}
.workareaAdmin {
	BORDER-RIGHT: #075685 2px solid; BORDER-TOP: #075685 0px solid; BORDER-LEFT: #075685 2px solid; BORDER-BOTTOM: #075685 2px solid; BACKGROUND-COLOR: #eeeeee
}
.listtable {
	BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.listcell1 {
	BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.listcell {
	BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.listblank {
	BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.detailtable {
	BORDER-RIGHT: #cccccc; BORDER-TOP: #cccccc; BORDER-LEFT: #cccccc; BORDER-BOTTOM: #cccccc; BACKGROUND-COLOR: #cccccc
}
.detaildata {
	BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.detaillabel {
	BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 1px solid; WIDTH: 10%; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #eeeeee
}
.detailblank {
	BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 0px solid; BACKGROUND-COLOR: #ffffff
}
.searchbox {
	BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 10px; BORDER-LEFT: #000000 1px solid; WIDTH: 80px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 20px
}
.searchbutton {
	BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9px; BORDER-LEFT: #000000 0px solid; WIDTH: 20px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 20px
}
.topSelector {
	COLOR: #ffffff; BACKGROUND-COLOR: #90a8c8
}
.menu {
	BORDER-RIGHT: #90a8c8 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #90a8c8 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; BACKGROUND: #90a8c8; BORDER-LEFT: #90a8c8 1px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #90a8c8 1px solid; FONT-FAMILY: Tahoma; HEIGHT: 30px; TEXT-ALIGN: center
}
.title {
	BORDER-RIGHT: #94acc8 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #94acc8 1px solid; FONT-SIZE: 13px; PADDING-BOTTOM: 2px; BORDER-LEFT: #94acc8 1px solid; CURSOR: hand; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #94acc8 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #94acc8
}
.LoginName {
	FONT-WEIGHT: 400; FONT-SIZE: 10px; COLOR: #ffffff; FONT-FAMILY: Tahoma
}
.ButtonOne {
	BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #eeeeee
}
.ButtonTwo {
	BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #eeeeee
}
.ButtonThree {
	BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #eeeeee
}
.ButtonTop {
	BORDER-RIGHT: #075685 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #075685 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 10px; BORDER-LEFT: #075685 1px solid; CURSOR: hand; COLOR: #ffffff; BORDER-BOTTOM: #075685 1px solid; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #075685
}
.buttonbar {
	BACKGROUND-COLOR: #e2e2e2
}
TT {
	FONT-SIZE: 13px; FONT-FAMILY: Tahoma
}
TEXTAREA {
	FONT-SIZE: 13px; FONT-FAMILY: Tahoma
}
BODY {
	FONT-SIZE: 12px; FONT-FAMILY: Tahoma
}
</STYLE>

<SCRIPT language=JavaScript>var formissent = 0;function onlyOneSubmit() {if (!formissent) {formissent = 1; return true; } else { return false; }}</SCRIPT>

<SCRIPT lang=javascript>
<!--
var dateCur = new Date(97,1,1);
function onRootExtract( id, s )
{
	var style = document.getElementById(id).style;
	var image = document.images[ "img" + id ];
	if( style.display == "none" ) { style.display = ""; image.src = "/s360v2/minus.gif"; document.cookie = id + "=; Expires=" + dateCur.toGMTString() + ";"; }
	else { style.display = "none"; image.src = "/s360v2/plus.gif"; document.cookie = id + "=1;"; }
}
function onExtract( id, s )
{
	var style = document.getElementById(id).style;
	var image = document.images[ "img" + id ];
	if( style.display == "none" ) { style.display = ""; image.src = "<%=BoxStatic.imageDir%>minus.gif"; document.cookie = id + "=1;"; }
	else { style.display = "none"; image.src = "<%=BoxStatic.imageDir%>plus.gif"; document.cookie = id + "=; Expires=" + dateCur.toGMTString() + ";"; }
}
//-->
</SCRIPT>

<STYLE>.treenode {
	LEFT: 16px; POSITION: relative
}
.onfolder {
	PADDING-RIGHT: 5px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BACKGROUND-COLOR: #e2e2e2
}
</STYLE>

<SCRIPT language=Javascript>
function over( style ) { style.borderLeftColor="#FFFFFF"; style.borderTopColor="#FFFFFF"; style.borderRightColor="#333333"; style.borderBottomColor="#333333"; }
function mout( style ) { style.borderColor="#90A8C8" }
function tout( style ) { style.borderColor="#94ACC8" }
function overborder( style, clr ) {style.borderColor=clr }
function moutborder( style, clr ) {style.borderColor=clr }
function showstatus( lbl ) { status = lbl; return true; }
function hidestatus() {status = ""; }
</SCRIPT>


<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
           <TD vAlign=bottom colspan=2>
          <form name="searchForm" method="post" action="<%=BoxStatic.servletDir%>FileLibSearchAction" >
          <BUTTON class=ButtonThree
            onclick="location.href='<%=BoxStatic.servletDir%>EditFolderAction?SubmitAdd=add';return false;">
            <NOBR><IMG src="<%=BoxStatic.imageDir%>folderwrite.gif"> Add Folder</NOBR>
          </BUTTON>

          <BUTTON class=ButtonThree
            onclick="location.href='<%=BoxStatic.servletDir%>EditFileAction?SubmitAdd=add';return false;">
              <NOBR><IMG src="<%=BoxStatic.imageDir%>pubfilewrite.gif"> Add File</NOBR>
          </BUTTON>

          <BUTTON class=ButtonThree
            onclick="location.href='<%=BoxStatic.servletDir%>EditFolderAction?SubmitView=view';return false;">
              <NOBR><IMG src="<%=BoxStatic.imageDir%>detail.gif"> Folder Details</NOBR>
          </BUTTON>
            <div align="right">
              <input type="text" name="SEARCH_TEXT">
              <input type="submit" name="SubmitQuickSearch" value="Search">
            </div>
          </form>
        </TD></TR>

        <TR vAlign=top>
          <TD style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" width="25%" bgColor=#ffffff>

            <filelib:FolderList currentFolder="<%=curFolderID%>" rootFolder="0" userid="<%=curID%>" />

          </TD>
          <TD style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px solid" width="75%">


            <TABLE cellSpacing=0 cellPadding=3 width="100%" bgColor=#ffffff border=0>
              <TBODY>

<%
    Iterator it = home.getEntries(curID, curFolderID, SORTBY, sortAsc).iterator();

    String[] headers = {"Name", "Filename", "Size", "Modified", "Owner"};
    String[] sortby = {"name", "filename", "size", "lastmodifiedtime", "ownerid"};
%>

      <TR bgColor=#cccccc>
          <common:ListHeader headers="<%=headers%>" sortby="<%=sortby%>" curSortBy="<%=SORTBY%>" sortAsc="<%=sortAsc%>" action="<%=folderContentAction%>" />
      </TR>
<%
  if (it != null && it.hasNext())
  {
%>
    <common:Iteration name="entry" type="FileLibEntry" group="<%=it%>">
<%
        if (entry.getIsfolder())
        {
%>
        <TR>
          <TD style="BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 1px solid" bgColor=#ffffff>
            <A title="" href="<%=BoxStatic.servletDir%>FolderContentAction?FOLDERID=<%=entry.getID()%>"><IMG src="<%=BoxStatic.imageDir%>folder.gif" border=0><%=entry.getName()%></A><BR></TD>
          <TD></TD>
          <TD></TD>
          <TD><%=entry.getLastmodifiedtimeString()%></TD>
          <TD><%=um.getUserDisplayName(entry.getOwnerid(), um.USERNAME_FORMAT_ALL)%></TD>
        </TR>
<%
        }
        else
        {
%>
        <TR bgColor=#ffffff>
          <TD style="BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 1px solid">
            <A href="<%=BoxStatic.servletDir%>EditFileAction?SubmitView=view&ID=<%=entry.getID()%>">
              <IMG hspace=1 src="<%=BoxStatic.imageDir%>pubfile.gif" border=0><%=entry.getName()%>
            </A>
          </TD>
          <TD style="BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 1px solid">
            <A href="<%=BoxStatic.servletDir%>DownloadFileAction?ID=<%=entry.getID()%>" >
              <%=entry.getFilename()%>
          </TD>
          <TD style="BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; BORDER-LEFT: #cccccc 0px solid; BORDER-BOTTOM: #cccccc 1px solid" noWrap align=right>
              <%=entry.getSizeString()%>
          </TD>
          <TD><%=entry.getLastmodifiedtimeString()%></TD>
          <TD><%=um.getUserDisplayName(entry.getOwnerid(), um.USERNAME_FORMAT_ALL)%></TD>
        </TR>
<%
        }
%>
    </common:Iteration>
<%
  }
%>
  </TBODY></TABLE>
</TD></TR></TBODY></TABLE>

      </TD></TR></TBODY></TABLE>




  <hr width=\"100%\" color=#E06000 align=left>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
